<template>
  <el-input
    type="number"
    ref="num"
    v-model="numValue"
    active-color="#13ce66"
    inactive-color="#ff4949"
	@input="valueChanged"
  ></el-input>
</template>
<script>
import Vue from 'vue'

export default {
  data() {
    return { numValue: 0, cancelBeforeStart: true }
  },
  methods: {
    getValue() {
      return this.numValue
    },
    isCancelBeforeStart() {
      return this.cancelBeforeStart
    },
	valueChanged(value){
	   if (this.params.cellUpdateHandler) {
        this.params.cellUpdateHandler(value)
      }
	}
  },
  created() {
    this.numValue = this.params.value
    this.cancelBeforeStart = false
  },
  mounted() {
    Vue.nextTick(() => {
      this.$refs.num.focus()
      this.$refs.num.select()
    })
  }
}
</script>
